<?php

$this->Html->script('controllers/Questions/admin.js?1', array('block' => 'scriptBottom'));
$this->Html->css('controllers/Questions/admin.css?1', array('block' => 'stylesTop'));
$appBosch->crud = $this->TioCachas->urlsCRUD();
$appBosch->upload = $this->Html->url(array('action' => 'uploadFiles'));
$appBosch->cancel = $this->Html->url(array('action' => 'deletedUploaded'));
$appBosch->urlMoes = $this->Html->url(array('controller' => 'Moes', 'action' => 'read'));
$appBosch->urlAreas = $this->Html->url(array('controller' => 'Areas', 'action' => 'getAreasByMoe', '1'));
$appBosch->urlLines = $this->Html->url(array('controller' => 'Lines', 'action' => 'getLinesByArea', '1'));
$appBosch->urlWorks = $this->Html->url(array('controller' => 'Workstations', 'action' => 'getWorkstationsByLine', '1'));

$appBosch->urlAAreas = $this->Html->url(array('controller' => 'Areas', 'action' => 'getAreasForCombo'));
$appBosch->urlALines = $this->Html->url(array('controller' => 'Lines', 'action' => 'getLinesForCombo'));
$appBosch->urlAWorks = $this->Html->url(array('controller' => 'Workstations', 'action' => 'getWorkstationsForCombo'));

$appBosch->Answers = new stdClass();
$appBosch->Answers->read = $this->Html->url(array('controller' => 'Answers', 'action' => 'read'));
$appBosch->Answers->create = $this->Html->url(array('controller' => 'Answers', 'action' => 'create'));
$appBosch->Answers->update = $this->Html->url(array('controller' => 'Answers', 'action' => 'update'));
$appBosch->Answers->destroy = $this->Html->url(array('controller' => 'Answers', 'action' => 'destroy'));
$appBosch->Answers->upload = $this->Html->url(array('controller' => 'Answers', 'action' => 'uploadFiles'));
$appBosch->Answers->cancel = $this->Html->url(array('controller' => 'Answers', 'action' => 'deletedUploaded'));

$titleSelec = __('Una pregunta puede aparecer en un examen si al menos tiene una respuesta correcta y una incorrecta');
?>

<?php if ($appBosch->src_type == 0) { ?>
    <div class="searchEmp">
        <div>
            <label for="moes"><?php echo __('MOE'); ?>:</label>
            <input id="moes" name="moe" style="width: 180px" required/>
        </div>
        <div>
            <label for="areas"><?php echo __('Área'); ?>:</label>
            <input id="areas" name="area" disabled="disabled" style="width: 200px" required/>
        </div>
        <div>
            <label for="lineas"><?php echo __('Línea'); ?>:</label>
            <input id="lineas" name="linea" disabled="disabled" style="width: 210px" required/>
        </div>
        <div>
            <label for="estaciones"><?php echo __('Operación'); ?>:</label>
            <input id="estaciones" name="estacion" disabled="disabled" style="width: 270px" required/>
        </div>
    </div>
<?php } ?>
    <div id="grid"></div>
    <div id="dlgAlertCreate">
        <p><?php echo __( 'Debes seleccionar al menos un MOE para poder agregar la pregunta.' ); ?></p>
    </div>
    <script id="templateRequired" type="text/kendo-template">
        #if(required == 1){#
        <i class='fa fa-check fa-2x'></i>
        #} else {#
        <i class='fa fa-times fa-2x'></i>
        #}#
    </script>
    <script id="templateMand" type="text/kendo-template">
        #if(mandatory == 1){#
        <i class='fa fa-check fa-2x'></i>
        #} else {#
        <i class='fa fa-times fa-2x'></i>
        #}#
    </script>
    <script id="templateSelec" type="text/kendo-template">
        #if(selec == 1){#
        <i class='fa fa-check fa-2x' title='<?php echo $titleSelec;?>'></i>
        #} else {#
        <i class='fa fa-times fa-2x' title='<?php echo $titleSelec;?>'></i>
        #}#
    </script>
<?php $this->start('jsVars'); ?>
    <script type="text/javascript">
        var appBosch = <?php echo json_encode($appBosch); ?>;
    </script>
<?php $this->end();